package com.pearadmin.hospital.service.impl;

import java.util.List;
import java.util.ArrayList;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.pearadmin.common.web.domain.request.PageDomain;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.pearadmin.hospital.mapper.HospitalReturnsupplierMapper;
import com.pearadmin.hospital.domain.HospitalReturnsupplier;
import com.pearadmin.hospital.service.IHospitalReturnsupplierService;

/**
 * 退货给供应商Service业务层处理
 * 
 * @author yuan
 * @date 2021-07-29
 */
@Service
public class HospitalReturnsupplierServiceImpl implements IHospitalReturnsupplierService 
{
    @Autowired
    private HospitalReturnsupplierMapper hospitalReturnsupplierMapper;

    /**
     * 查询退货给供应商
     * 
     * @param id 退货给供应商ID
     * @return 退货给供应商
     */
    @Override
    public HospitalReturnsupplier selectHospitalReturnsupplierById(Integer id)
    {
        return hospitalReturnsupplierMapper.selectHospitalReturnsupplierById(id);
    }

    /**
     * 查询退货给供应商列表
     * 
     * @param hospitalReturnsupplier 退货给供应商
     * @return 退货给供应商
     */
    @Override
    public List<HospitalReturnsupplier> selectHospitalReturnsupplierList(HospitalReturnsupplier hospitalReturnsupplier)
    {
        return hospitalReturnsupplierMapper.selectHospitalReturnsupplierList(hospitalReturnsupplier);
    }

    /**
     * 查询退货给供应商
     * @param hospitalReturnsupplier 退货给供应商
     * @param pageDomain
     * @return 退货给供应商 分页集合
     * */
    @Override
    public PageInfo<HospitalReturnsupplier> selectHospitalReturnsupplierPage(HospitalReturnsupplier hospitalReturnsupplier, PageDomain pageDomain)
    {
        PageHelper.startPage(pageDomain.getPage(),pageDomain.getLimit());
        List<HospitalReturnsupplier> data = hospitalReturnsupplierMapper.selectHospitalReturnsupplierList(hospitalReturnsupplier);
        return new PageInfo<>(data);
    }

    /**
     * 新增退货给供应商
     * 
     * @param hospitalReturnsupplier 退货给供应商
     * @return 结果
     */

    @Override
    public int insertHospitalReturnsupplier(HospitalReturnsupplier hospitalReturnsupplier)
    {
        return hospitalReturnsupplierMapper.insertHospitalReturnsupplier(hospitalReturnsupplier);
    }

    /**
     * 修改退货给供应商
     * 
     * @param hospitalReturnsupplier 退货给供应商
     * @return 结果
     */
    @Override
    public int updateHospitalReturnsupplier(HospitalReturnsupplier hospitalReturnsupplier)
    {
        return hospitalReturnsupplierMapper.updateHospitalReturnsupplier(hospitalReturnsupplier);
    }

    /**
     * 删除退货给供应商对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteHospitalReturnsupplierByIds(String[] ids)
    {
        return hospitalReturnsupplierMapper.deleteHospitalReturnsupplierByIds(ids);
    }

    /**
     * 删除退货给供应商信息
     * 
     * @param id 退货给供应商ID
     * @return 结果
     */
    @Override
    public int deleteHospitalReturnsupplierById(Integer id)
    {
        return hospitalReturnsupplierMapper.deleteHospitalReturnsupplierById(id);
    }
}
